{% extends "master.html" %}
{% block subtitle %} - 基础信息 - 商品管理{% endblock %}

{% block extJS %}
<script language="JavaScript" type="text/javascript">
//<![CDATA[
    function toSbumit(){
        $("#dataForm").submit();
        
    }
//]]>
</script>
{% endblock %}




{% block main %}
<div class="container">
    <div class="row">
        <ul class="breadcrumb">
          <li><a href="{{url_for('bpMas.view')}}">基础信息</a> <span class="divider">\</span></li>
          <li class="active">商品管理</li>
        </ul>
    </div>
    
    <div class="row">
        {{mymacros.render_search_form(form,3)}}
    </div>
    <div class="row">    
        <div class="btn-toolbar pull-right">
            <div class="btn-group"><button type="button" class="btn" onclick="$('.searchForm').submit()">{{BTN_SEARCH}}</button></div>
            {% if getAllPermission(['PRODUCT_EDIT',])%}
                <div class="btn-group"><button type="button" class="btn" onclick="return toSbumit()">批量修改</button></div>
            {% endif %}
            {% if getAllPermission(['PRODUCT_CREATE',])%}
                <div class="btn-group"><a href="{{url_for('bpPdt.view',action='add')}}" class="btn btn-primary">创建商品</a></div>
            {% endif %}
        </div>
    </div>
    
    <div class="row">
        <form method='post' action="{{url_for('.view',action='batchUpdate')}}" enctype="multipart/form-data" id="dataForm">
        <table class="table table-bordered">
            <thead>
                <tr>
                    {% if getAllPermission(['PRODUCT_EDIT',])%}
                        <td class="span1"><input type="checkbox" onclick="selectall(this,'pdt')"/></td>
                    {% endif %}
                    <td class="span3">商品编号</td>
                    <td>商品名称</td>
                    <td class="span1">类型</td>
                    <td class="span1">买价</td>
                    <td class="span1">卖价</td>
                    <td class="span2">经办人</td>
                    <td class="span2">创建时间</td>
                </tr>
            </thead>
            <tbody>
                {% for r in result.items %}
                    <tr>
                        {% if getAllPermission(['PRODUCT_EDIT',])%}
                            <td><input type="checkbox" name="pdt" value="{{r.id}}"/></td> 
                        {% endif %}
                        <td>
                            {{mymacros.render_thumb(r, True)}}
                            <a href="{{url_for('bpPdt.view',action='view',id=r.id)}}">{{r.no}}</a>
                        </td>
                        <td>{{r.name}}</td>
                        <td>{{r.type|f}}</td>
                        <td>{{r.pPrice|f}}</td>
                        <td>{{r.sPrice|f}}</td>
                        <td>{{r.createBy|f}}</td>
                        <td>{{r.createTime|ft}}</td>
                    </tr>
                {% endfor %}
            <tbody>
        </table>
        </form>
        {{mymacros.mypaginate(result)}}
    </div>
</div>
{% endblock %}